//
//  KWNPhotoDetailViewController.m
//  KWNClient
//
//  Created by 张明磊 on 14/11/3.
//  Copyright (c) 2014年 张明磊. All rights reserved.
//

#import "KWNPhotoDetailViewController.h"

@interface KWNPhotoDetailViewController ()

@property (nonatomic, weak) id <KWNPhotoDetailDelegate> delegate;
@property (weak, nonatomic) UIPageControl *page;
@end

@implementation KWNPhotoDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self UI_photoDetail];
    [self setZoomPhotosToFill:NO];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)UI_photoDetail{
    UIView *view_tabBar = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 80, self.view.frame.size.width, 80)];
    view_tabBar.backgroundColor = [UIColor blackColor];
    [self.view addSubview:view_tabBar];
    
    UIButton *button_back = [UIButton buttonWithType:UIButtonTypeCustom];
    button_back.frame = CGRectMake(0, 20, 60, 45);
    button_back.backgroundColor = [UIColor clearColor];
    [button_back setImage:[UIImage imageFileName:@"button_setBack.png"] forState:UIControlStateNormal];
    [button_back addTarget:self action:@selector(didClickButton_photoDetail:)forControlEvents:UIControlEventTouchUpInside];
    [view_tabBar addSubview:button_back];
    
    if(_int_tag == 0){
        UIButton *button_delete = [UIButton buttonWithType:UIButtonTypeCustom];
        button_delete.frame = CGRectMake(self.view.frame.size.width - 60, 20, 60, 45);
        button_delete.backgroundColor = [UIColor clearColor];
        [button_delete setImage:[UIImage imageFileName:@"button_xiangceDelete.png"] forState:UIControlStateNormal];
        [button_delete addTarget:self action:@selector(didClickButton_delete:)forControlEvents:UIControlEventTouchUpInside];
        [view_tabBar addSubview:button_delete];
    }
    
    UIPageControl *page = [[UIPageControl alloc] initWithFrame:CGRectMake(145, 30, 30, 30)];
    page.numberOfPages = 2;
    [view_tabBar addSubview:page];
    page.hidden = YES;
    _page = page;
}

- (void)didClickButton_photoDetail:(UIButton *)button{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
    [self dealloc_noAuto];
}

- (void)didClickButton_delete:(UIButton *)button{
    _page.hidden = YES;
    [self.delegate delegate_didClickDeleteInController:self];
}

- (void)scrollPageViewToIndex:(NSInteger )int_page andBoolScroll:(BOOL )bool_scroll{
    if(bool_scroll){
        _page.hidden = NO;
        _page.currentPage = int_page;
    }
    else{
        _page.hidden = YES;
    }
}

@end
